﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Samples.Office.UnifiedCommunications.Gadget.Config
{
    public class PresenceEventElement : ConfigurationElement
    {
        private static ConfigurationProperty presenceEventId;
        private static ConfigurationProperty sipUri;
        private static ConfigurationProperty presenceEventDateTime;
        private static ConfigurationProperty statusText;

        private static ConfigurationPropertyCollection properties;

        public PresenceEventElement()
        {
            presenceEventId = new ConfigurationProperty("presenceEventId", typeof(Guid), null, ConfigurationPropertyOptions.IsKey);
            sipUri = new ConfigurationProperty("sipUri", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
            presenceEventDateTime = new ConfigurationProperty("presenceEventDateTime", typeof(DateTime), null, ConfigurationPropertyOptions.IsRequired);
            statusText = new ConfigurationProperty("statusText", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
 
            properties = new ConfigurationPropertyCollection();

            properties.Add(presenceEventId);
            properties.Add(sipUri);
            properties.Add(presenceEventDateTime);
            properties.Add(statusText);
        }

        [ConfigurationProperty("presenceEventId", IsKey = true, IsRequired = true)]
        public Guid PresenceEventId
        {
            get { return (Guid)base[presenceEventId]; }
            set { base[presenceEventId] = value; }
        }

        [ConfigurationProperty("sipUri", IsRequired = true)]
        public string SipUri
        {
            get { return (string)base[sipUri]; }
            set { base[sipUri] = value; }
        }

        [ConfigurationProperty("presenceEventDateTime", IsRequired = true)]
        public DateTime PresenceEventDateTime
        {
            get { return (DateTime)base[presenceEventDateTime]; }
            set { base[presenceEventDateTime] = value; }
        }

        [ConfigurationProperty("statusText", IsRequired = true)]
        public string StatusText
        {
            get { return (string)base[statusText]; }
            set { base[statusText] = value; }
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get { return properties; }
        }
    }
}
